package org.wiztools.thegreatwall;

import java.io.IOException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author arun
 */
public class ViewWallsServlet extends HttpServlet {

    private static final Logger LOG = Logger.getLogger(ViewWallsServlet.class.getName());

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse res)
            throws ServletException, IOException {
        LOG.info("View Walls Servlet: doGet() ");
        try {
            List<Wall> w = new MySQLOperations().getAllWall();
            req.setAttribute("walls", w);
            req.getRequestDispatcher("/walls.jsp").forward(req, res);
        } catch (OperationException ex) {
            LOG.log(Level.SEVERE, null, ex);
        }
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }

    

}
